package com.example.smartclassroom.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.smartclassroom.entity.form.LoginForm;
import com.example.smartclassroom.entity.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface StudentMapper extends BaseMapper<Student> {
    //登录
    @Select("select * from student where username=#{username} and password=#{password}")
    Student login(LoginForm loginForm);

    //注册
    @Insert("insert into student(username,password) values(#{username},#{password})")
    Integer insert(LoginForm loginForm);

    //编辑学生信息
    @Select("update student set student_name=#{studentName},phone=#{phone},avatar=#{avatar} where id=#{id}")
    Integer update(Student student);
}
